package pl.edu.mimuw.irs.rcp.controller.menu.builder;

import java.util.LinkedList;
import java.util.List;

import org.eclipse.gef.EditPart;
import org.eclipse.jface.action.IMenuManager;

import pl.edu.mimuw.irs.rcp.controller.action.ResourceSetEditionAction;
import pl.edu.mimuw.irs.rcp.controller.part.IRSResourceSetEditPart;

public class ResourceSetContextMenuBuilder extends NodeContextMenuBuilder {

	// *** Attributes

	// *** Methods
	
	@Override
	public void build(IMenuManager menu) {
		super.build(menu);
		
		List<IRSResourceSetEditPart> editParts = new LinkedList<IRSResourceSetEditPart>();
		for (EditPart part : getSelection()) {
			if (part instanceof IRSResourceSetEditPart) {
				editParts.add((IRSResourceSetEditPart)part);
			}
		}
		
		if (editParts.size() == 1) {
			IRSResourceSetEditPart nodeEditPart = editParts.get(0);
			menu.add(new ResourceSetEditionAction(nodeEditPart));
		}
	}
}
